<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Frog.NET</title>
        
        <link rel="Stylesheet" href="style.css" type="text/css" />
    </head>

    <body>
        <table class="navbar">
            <tr>
                <td>Frog.NET</td>
                <td align="right">v0.3</td>
            </tr>
        </table>
        
        <div id="logoContainer"><img src="frog.jpg" id="logo" /></div>

        <div id="mainText">
            <br />
            <a href="index.html">Home</a>
            
            <h1>Testing</h1>
            
            Frog.NET has pretty good built-in support for unit testing - well some would argue that its really an integration test 
            once your using a database. Anyway, the strategy I have used for testing is to create a database connection to an 
            in-memory SQLite database. When the test finishes, I just discard the connection and everything is back to normal, ready 
            for the next test to run.<br />
            <br />
            This approach has very low execution time, and closely mimics how the real database will work. Since Frog.NET code is 
            database independent, you can also choose to run your test suite against a real database like SQL Server.<br />
            <br />
            A typical example:<br />
            <!-- code formatted by http://manoli.net/csharpformat/ -->
            <div class="csharpcode">
            <pre><span class="lnum">   1:  </span>        [<span class="str">Test</span>]</pre>
            <pre><span class="lnum">   2:  </span>        <span class="kwrd">public</span> <span class="kwrd">void</span> RemoveAll()</pre>
            <pre><span class="lnum">   3:  </span>        {</pre>
            <pre><span class="lnum">   4:  </span>            <span class="kwrd">using</span> (var connection = <span class="kwrd">new</span> SqliteConnection(<span class="str">"Data Source=:memory:;version=3"</span>);)</pre>
            <pre><span class="lnum">   5:  </span>            {</pre>
            <pre><span class="lnum">   6:  </span>                var repository = <span class="kwrd">new</span> <span class="str">Repository</span>(connection);</pre>
            <pre><span class="lnum">   7:  </span>                CreateThreeCustomers(repository);</pre>
            <pre><span class="lnum">   8:  </span>&nbsp;</pre>
            <pre><span class="lnum">   9:  </span>                repository.RemoveAll&lt;<span class="str">Customer</span>&gt;();</pre>
            <pre><span class="lnum">  10:  </span>                Assert.That(repository.GetAll&lt;<span class="str">Customer</span>&gt;().Count(), <span class="str">Is</span>.EqualTo(0));</pre>
            <pre><span class="lnum">  11:  </span>            }</pre>
            <pre><span class="lnum">  12:  </span>        }</pre>
            </div>
            
            <br /><br /><br />
        </div>
        
        <div class="footer">
        Frog.NET 
        </div>
    </body>
</html>
